import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "Login" */ '../views/Login.vue')
  },
  {
    path: '/',
    redirect: '/login'
  },
  // 后台管理界面组件配置
  /* {
    path:'/back/xxx',
    name: 'Login',
    component: () => import('../adminPage/XXX.vue')
  },
  */
  // 前台商城界面组件配置
  {
    path: '/front/home',
    name: 'Home',
    component: () => import('../views/front/Home.vue'),
    children: [
      {
        path: 'recommend',
        name: 'Recommend',
        component: () => import('../views/front/Recommend.vue')
      }
    ]
  },
  {
    path: '/admin',
    name: 'AdminPage',
    redirect: '/book',
    component: () => import(/* webpackChunkName: "Login" */ '../views/back/AdminPage.vue'),
    children: [
      {
        path: '/book',
        name: 'BookManager',
        component: () => import(/* webpackChunkName: "Login" */ '../views/back/BookManager.vue')
      },
      {
        path: '/bookType',
        name: 'BookTypeManager',
        component: () => import(/* webpackChunkName: "Login" */ '../views/back/BookTypeManager.vue')
      },
      {
        path: '/order',
        name: 'OrderManager',
        component: () => import(/* webpackChunkName: "Login" */ '../views/back/OrderManager.vue')
      },
      {
        path: '/user',
        name: 'UserManager',
        component: () => import(/* webpackChunkName: "Login" */ '../views/back/UserManager.vue')
      },
      {
        path: '/comment',
        name: 'CommentManager',
        component: () => import(/* webpackChunkName: "Login" */ '../views/back/CommentManager.vue')
      }]
  }
]
const router = new VueRouter({
  routes
})

export default router
